package com.doudou.client;

import com.doudou.client.config.FeignClientBasicAuthConfig;
import com.doudou.client.entity.AppClientDetailsDto;
import com.doudou.client.entity.UserAccountInfoDto;
import com.doudou.client.entity.UserDetailsInfoDto;
import com.doudou.commons.entity.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Author: 傻男人
 * @Date: 2020/6/2 14:01
 * @Version: 1.0
 * @Description:
 */
@FeignClient(name = "basic",configuration = FeignClientBasicAuthConfig.class)
public interface BasicClient {

    @GetMapping(value = "/auth/client/{clientId}/clientId")
    Result<AppClientDetailsDto> findByClientId(@PathVariable("clientId")String clientId);

    @GetMapping(value = "/auth/account/username")
    Result<UserAccountInfoDto> findByUsername(@RequestParam("username")  String username);


    @GetMapping(value = "/auth/details/{userId}/userId")
    Result<UserDetailsInfoDto> findUserDetailsInfoByUserId(@PathVariable("userId")Long userId);


    @ApiOperation(value = "通过手机号码查找用户信息，如没有则注册用户",notes = "通过手机号码查找用户信息，如没有则注册用户")
    @GetMapping(value = "/auth/account/phone")
    Result<UserAccountInfoDto> findNoRegisterByPhone(@RequestParam("phone")String phone);
}
